using UnityEngine;
using System.Collections;

public class Player_Locomocao : MonoBehaviour {
	
	public float velLocomocaoVertical, velLocomocaoHorizontal;
	public float TopLimit, BottonLimit;
	public GameObject Player;
	public GameObject Projetil;	
	void Start () {
	
	}
	void Update () {
	
		if(Input.GetKey("up") && Player.transform.position.y < TopLimit)
		{
			Player.transform.Translate(new Vector3(0,velLocomocaoVertical,0)*Time.deltaTime);	
		}
		if(Input.GetKey("down") && Player.transform.position.y > BottonLimit)
		{
			Player.transform.Translate(new Vector3(0, -velLocomocaoVertical,0)*Time.deltaTime);
		}
		if(Input.GetKey("left"))
		{
			Player.transform.localEulerAngles = new Vector3(0,180,0);
			Player.transform.Translate(new Vector3(velLocomocaoHorizontal,0,0)*Time.deltaTime);	
		}
		if(Input.GetKey("right"))
		{
			Player.transform.localEulerAngles = new Vector3(0,0,0);
			Player.transform.Translate(new Vector3(velLocomocaoHorizontal,0,0)*Time.deltaTime);
		}
		
		if(Input.GetButtonDown("Fire1"))
		{
			GameObject TempProjetil = Instantiate(Projetil, new Vector3(Player.transform.position.x, Player.transform.position.y,Player.transform.position.z), new Quaternion(0,transform.localEulerAngles.y,0,0)) as GameObject;
		}
	}
}
